Out: Monday, April 4, 2016
Due: Monday, April 11, 2016 at 5pm.
The goal of this problem set is to give you experience with inheritance and the model-view-controller architecture.
For this problem, you will re-factor your solution for Problem Set 10 to use inheritance whenever that would simplify your design and minimize repeated code. You will also add some controls to the launcher, and should use the MVC pattern in that part of your program. (You do not have to rewrite your entire program to use the MVC pattern, although you may do that if you wish.)
Otherwise, the deliverables and instructions for this problem set are the same as for Problem Sets 09-10. As always, you must follow the design recipe, in this case the OO Design Recipe and deliverables as spelled out in Lesson 9.5 and in deliverables.html. Be sure to sync your work and fill out a Work Session Report at the end of every work session. Use the Work Session Report for PS 11.
As with problem set 10, you may submit your solution
in multiple files.
Your solution must include files named
simulator-3.rkt
,
StatefulWorld.rkt
, and
extras.rkt
.
simulator-3
)
Your program must include a file named simulator-3.rkt
that provide
s exactly the same list of
functions and interfaces as before, and passes all black-box tests
for Problem Set 10, but adds the following behaviors:
MouseEvent
might select one or more goofballs
as well.)
"drag"
lies within the
rightmost quarter of the arena, then
the y coordinate of a "drag"
event that occurs
while the launcher is selected becomes the new y coordinate
of the launcher; the launcher's x coordinate cannot be changed
by a smooth drag.
If the x coordinate of a "drag"
lies outside the
rightmost quarter of the arena, then the launcher does not
move and becomes unselected.
(Dragging the launcher may drag selected goofballs as well.
Dragged goofballs may remain selected even if the launcher
becomes unselected.)
"t"
pops up a graphical controller for
the initial velocity of DAGRs.
"button-down"
events whose mouse coordinates
lie on or within the yellow semicircle will not affect any
goofballs that lie underneath the graphical controller.
"button-up"
event unselects the solid circle,
the graphical controller disappears from the screen, and
the x and y coordinates of the solid yellow circle's last position
are converted into velocity components vx and vy by subtracting
the corresponding coordinates of the launcher, dividing by 10,
and rounding to the nearest integer (with rounding to even in
case of a tie).
If the launcher is at position (800,500), for example, and the
solid yellow circle is dragged to position (755,498), then newly
launched DAGRs will have an initial velocity of (-4,0).
Last modified: Mon Apr 04 2016